﻿namespace CodeContrib
{
	public class RandomTopLevelDomain : IRandom<string>
	{
		private readonly RandomItem<string> _randomTopLevelDomain;
		private static readonly string[] _topLevelDomains;

		static RandomTopLevelDomain()
		{
			_topLevelDomains = new[]
				                   {
					                   "biz", "com", "co.uk", "edu", "gov", "info", "mobi", "name", "net", "org"
				                   };
		}

		public RandomTopLevelDomain()
		{
			_randomTopLevelDomain = new RandomItem<string>(_topLevelDomains);
		}

		public string Next()
		{
			return _randomTopLevelDomain.Next();
		}
	}
}